ArrayList is the most common implementation of the List interface in the java collection framework. However, ArrayList allows identical elements to be stored. Although java has another Set called Set, it is used to store non-repeated elements.
1. Remove duplicate string elements from the ArrayList collection (same string content)Analysis:(1) Creating a Collection Object(2) Adding multiple string elements (containing duplicates)(3) Create a new collection(4) Iterate through the old
ArrayList set, arraylist
Reason why a set appearsArray Storage Data is a fixed storage. When the number of data to be stored is uncertain, the array is not satisfied, and the set appears.The number of data stored in a set can change with the amount
Let's take a look at the underlying implementation of ArrayList,ArrayList inherits the Abstractlist, realizes Cloneable, Serializable, randomaccess interface,Its member properties are object[] elementdata and int size,Obviously the bottom layer is
List InterfaceThe list interface is a sub-interface of the collection interface, the abstract method in the list interface, and a part of the method and his parent interface collection is the same, the list interface's own unique method, with the
/// ///convert a string array into a shaped array and bubble sort/// /// /// Private int[] Arrtoint (string[] str) { int[] arr2 =New int[Str. Length];//used to store strings converted to int[]
Let's take a look at the basic information of the following collection
1. The collection types in FCL are divided into generic sets and Non-generic collections.
2. Classes and interfaces for Non-generic collections are located in the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.